/*
 ============================================================================
 Name        : usrSimpleApp.c
 Author      :
 Version     :
 Copyright   : Your copyright notice
 Description : Hello World in C, Ansi-style
 ============================================================================
 */

#define _GNU_SOURCE
#include <sched.h>
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
#include <semaphore.h>
#include <error.h>
#include <malloc.h>
#include <assert.h>
#include <fcntl.h>
#include <getopt.h>
#include <stdint.h>
#include <string.h>
#include <time.h>

#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/select.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>

#include "reg_rw.h"

extern unsigned long long xdma_bypass_word;
//extern unsigned long long last_word;


unsigned long long xdma_bypass_read()
{
	int bypass=open("/dev/xdma0_bypass", O_RDWR | O_SYNC);
	if(bypass<0)
	{
		printf("Open device error! check your backup card or driver\n");
		return -1;
	}
	int res = reg_bypass_rw(bypass,0);
	if(res!=0)
	{
		printf("read bypass error! check your backup card or driver\n");
		return -1;
	}
	close(bypass);
	return xdma_bypass_word;
}
